﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NeedMaterialDetailEdit.aspx.cs" Inherits="weba.Sales.NeedMaterialDetailEdit" %>

<%@ Register Assembly="C1.Web.Wijmo.Controls.4, Version=4.0.20133.145, Culture=neutral, PublicKeyToken=9b75583953471eea" Namespace="C1.Web.Wijmo.Controls.C1AutoComplete" TagPrefix="wijmo" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
           
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="30" background="../Images/tab_05.gif">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="12" height="30">
                                        <img src="../Images/tab_03.gif" width="12" height="30" />
                                    </td>
                                    <td>
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td width="46%" valign="middle">
                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td>
                                                                <div align="center">
                                                                    <img src="../images/tb.gif" width="16" height="16" /></div>
                                                            </td>
                                                            <td width="95%">
                                                                <span class="titleBold12px">管理用料单明细</span>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                                <td width="54%" align="right">
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td width="16" height="30">
                                        <img src="../Images/tab_07.gif" width="16" height="30" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="8" background="../images/tab_12.gif">
                                        &nbsp;
                                    </td>
                                    <td>
                                        <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
                                            <asp:Panel runat="server" ID="pnlAdd" Width="100%" Visible="true">
                                                <tr>
                                                    <td width="100" height="30" align="right">
                                                        材料类型：
                                                    </td>
                                                    <td>
                                                        <asp:RadioButtonList ID="rbtnlMaterialCategoryID" runat="server" RepeatDirection="Horizontal"  RepeatLayout="Flow">
                                                        </asp:RadioButtonList>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ControlToValidate="rbtnlMaterialCategoryID"
                                                            Display="Dynamic" ErrorMessage="请选择材料类型" SetFocusOnError="True" ValidationGroup="val"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width="100" height="30" align="right">
                                                        名称/货号：
                                                    </td>
                                                    <td>
                                                        <wijmo:C1AutoComplete ID="txtName" runat="server" DataLabelField="Name" DataMember="DefaultView" DataSourceID="SqlDataSource1" DataValueField="Name" AutoPostBack="True"  OnTextChanged="txtName_TextChanged"></wijmo:C1AutoComplete>
                                                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:mysjkConnectionString1 %>" SelectCommand="SELECT DISTINCT [Name] FROM [Sales_Material]"></asp:SqlDataSource>
                                                        <%--<asp:TextBox ID="txtName" runat="server" AutoPostBack="True" OnTextChanged="txtName_TextChanged"></asp:TextBox>--%>
                                                       
                                                        <asp:Label ID="lblSalesOrderID" runat="server" Visible="False"></asp:Label>
                                                        <asp:Label ID="lblNeedMaterialID" runat="server" Visible="False"></asp:Label>
                                                        <asp:Label ID="lblRootDepartmentID" runat="server" Visible="False"></asp:Label>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width="100" height="30" align="right">
                                                        厂家代码：
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txtManufacturerCode" runat="server" Width="50px"></asp:TextBox>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic"
                                                            ErrorMessage="请输入厂家代码" SetFocusOnError="True" ValidationGroup="val" ControlToValidate="txtManufacturerCode"></asp:RequiredFieldValidator>
                                                        <asp:CustomValidator ID="CustomValidator2" runat="server" ControlToValidate="txtManufacturerCode"
                                                            Display="Dynamic" ErrorMessage="厂家代码错误，请重新输入" OnServerValidate="CustomValidator2_ServerValidate"
                                                            SetFocusOnError="True" ValidationGroup="val"></asp:CustomValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width="100" height="30" align="right">
                                                        单价：
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txtUnitPrice" runat="server" Width="50px"></asp:TextBox>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" Display="Dynamic"
                                                            ErrorMessage="请输入单价" SetFocusOnError="True" ValidationGroup="val" ControlToValidate="txtUnitPrice"></asp:RequiredFieldValidator>
                                                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ValidationGroup="val"
                                                            runat="server" ErrorMessage="只能输入整数或小数" ValidationExpression="^(\d)+(\.\d+)?$"
                                                            ControlToValidate="txtUnitPrice"></asp:RegularExpressionValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width="100" height="30" align="right">
                                                        数量：
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txtQuantity" runat="server" ValidationGroup="val2" Width="50px"></asp:TextBox>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="txtQuantity"
                                                            Display="Dynamic" ErrorMessage="请输入数量" SetFocusOnError="True" ValidationGroup="val"></asp:RequiredFieldValidator>
                                                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" ValidationGroup="val"
                                                            runat="server" ErrorMessage="只能输入整数或小数" ValidationExpression="^(\d)+(\.\d+)?$"
                                                            ControlToValidate="txtQuantity"></asp:RegularExpressionValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" align="center">
                                                        <asp:Label ID="lblMsg2" runat="server" ForeColor="Red"></asp:Label>
                                                        <br />
                                                        <asp:Button ID="btnAddProduct" runat="server" Text="添加" OnClick="btnAddProduct_Click"
                                                            ValidationGroup="val" Font-Size="16px" Width="200px" Height="30px" />
                                                    </td>
                                                </tr>
                                            </asp:Panel>
                                            <tr>
                                                <td colspan="2" align="center">
                                                    <br />
                                                    <hr />
                                                    <asp:CustomValidator ID="CustomValidator1" runat="server" Display="Dynamic" ErrorMessage="请至少添加一项产品"
                                                        OnServerValidate="CustomValidator1_ServerValidate" ValidationGroup="ok"></asp:CustomValidator>
                                                    <br />
                                                    <asp:GridView ID="myGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="DetailID,MaterialID,ManufacturerID"
                                                        OnRowDeleting="myGridView_RowDeleting" Width="100%" OnRowDataBound="myGridView_RowDataBound" OnSelectedIndexChanged="myGridView_SelectedIndexChanged">
                                                        <Columns>
                                                            <asp:BoundField DataField="DetailID" HeaderText="ID" />
                                                            <asp:BoundField DataField="Name" HeaderText="货号" />
                                                            <asp:BoundField DataField="UnitPrice" DataFormatString="{0:c}" HeaderText="单价" />
                                                            <asp:BoundField DataField="Quantity" HeaderText="数量" />
                                                            <asp:BoundField DataField="Subtotal" DataFormatString="{0:c}" HeaderText="小计" />
                                                            <asp:TemplateField HeaderText="删除" ShowHeader="False">
                                                                <ItemTemplate>
                                                                    <asp:LinkButton ID="lbtnDel" runat="server" CausesValidation="False" CommandName="Delete"
                                                                        OnClientClick="return confirm(&quot;将删除此项目，且无法恢复，您确认删除此记录吗？&quot;)" Text="删除"></asp:LinkButton>
                                                                </ItemTemplate>
                                                                <ItemStyle Width="50px" />
                                                            </asp:TemplateField>
                                                        </Columns>
                                                    </asp:GridView>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="100" height="30" align="right">
                                                    客户合同金额：
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="txtContractAmount" runat="server"></asp:TextBox>
                                                    元<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtContractAmount"
                                                        Display="Dynamic" ErrorMessage="请输入合计金额" SetFocusOnError="True" ValidationGroup="ok"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator6" ValidationGroup="ok"
                                                        runat="server" ErrorMessage="只能输入整数或小数" ValidationExpression="^(\d)+(\.\d+)?$"
                                                        ControlToValidate="txtContractAmount"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="100" height="30" align="right">
                                                    用料合计金额：
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="txtSubTotal" runat="server"></asp:TextBox>
                                                    元<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="txtSubTotal"
                                                        Display="Dynamic" ErrorMessage="请输入合计金额" SetFocusOnError="True" ValidationGroup="ok"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" ValidationGroup="ok"
                                                        runat="server" ErrorMessage="只能输入整数或小数" ValidationExpression="^(\d)+(\.\d+)?$"
                                                        ControlToValidate="txtSubTotal"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="100" height="30" align="right">
                                                    客户实付款：
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="txtTotalDue" runat="server"></asp:TextBox>
                                                    元<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ControlToValidate="txtTotalDue"
                                                        Display="Dynamic" ErrorMessage="请输入实付款" SetFocusOnError="True" ValidationGroup="ok"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" ValidationGroup="ok"
                                                        runat="server" ErrorMessage="只能输入整数或小数" ValidationExpression="^(\d)+(\.\d+)?$"
                                                        ControlToValidate="txtTotalDue"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="100" height="30" align="right">
                                                    其他金额：
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="txtBrokerage" runat="server"></asp:TextBox>
                                                    元<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtBrokerage"
                                                        Display="Dynamic" ErrorMessage="请输入其他金额" SetFocusOnError="True" ValidationGroup="ok"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" ValidationGroup="ok"
                                                        runat="server" ErrorMessage="只能输入整数或小数" ValidationExpression="^(\d)+(\.\d+)?$"
                                                        ControlToValidate="txtBrokerage"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2" align="center">
                                                    <asp:Button ID="btnOK" runat="server" Text="保存修改" OnClick="btnOK_Click" Font-Size="16px"
                                                        Width="100px" Height="30px" ValidationGroup="ok" />
                                                    &nbsp;
                                                    <asp:Button ID="btnSubmit" runat="server" Font-Size="16px" Height="30px" OnClick="btnSubmit_Click"
                                                        Text="提交审核" ValidationGroup="ok" Width="100px" OnClientClick="return confirm(&quot;将提交订单至财务审核，且无法再修改，您确认提交此订单吗？&quot;)" />
                                                    &nbsp;
                                                    <asp:Button ID="btnClose" runat="server" Font-Size="16px" Height="30px" Text="关闭"
                                                        Width="100px" OnClientClick="window.close();" />
                                                    <br />
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td width="8" background="../images/tab_15.gif">
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="35" background="../images/tab_19.gif">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="12" height="35">
                                        <img src="../images/tab_18.gif" width="12" height="35" />
                                    </td>
                                    <td align="center">
                                        &nbsp;
                                    </td>
                                    <td width="16">
                                        <img src="../images/tab_20.gif" width="16" height="35" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
               
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
